package es.xpt.ysf.web.service;

import es.xpt.ysf.configuration.Configuration;

public class YedraConfigureListener extends org.jboss.web.jsf.integration.config.JBossMojarra12ConfigureListener {

	@Override
	public void doVersionSpecificInitialization() {
		
		
		
		
		Configuration c = new Configuration("development");
		if ( !c.getConfiguration().isEmpty() ) {
			// Desarrollo
			servletContext.setInitParameter("facelets.DEVELOPMENT", "true");
			servletContext.setInitParameter("facelets.SKIP_COMMENTS", "true");
			servletContext.setInitParameter("org.apache.myfaces.PRETTY_HTML", "true");
			servletContext.setInitParameter("org.apache.myfaces.CHECK_EXTENSIONS_FILTER", "true");
		} else {
			// Produccion
			servletContext.setInitParameter("facelets.DEVELOPMENT", "false");
//			servletContext.setInitParameter("javax.faces.FACELETS_SKIP_COMMENTS", "true");
			servletContext.setInitParameter("facelets.SKIP_COMMENTS", "true");
			servletContext.setInitParameter("org.apache.myfaces.PRETTY_HTML", "false");
			servletContext.setInitParameter("org.apache.myfaces.CHECK_EXTENSIONS_FILTER", "false");
		}
		
				
		servletContext.setInitParameter("org.apache.myfaces.ALLOW_JAVASCRIPT", "true");
		servletContext.setInitParameter("org.apache.myfaces.DETECT_JAVASCRIPT", "false");
		servletContext.setInitParameter("org.apache.myfaces.AUTO_SCROLL", "true");
		servletContext.setInitParameter("org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS", "true");
		servletContext.setInitParameter("org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON", "false");
		servletContext.setInitParameter("org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS", "false");
		servletContext.setInitParameter("org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE", "false");
		servletContext.setInitParameter("org.apache.myfaces.RENDER_VIEWSTATE_ID", "true");
		servletContext.setInitParameter("org.apache.myfaces.STRICT_XHTML_LINKS", "true");
		servletContext.setInitParameter("org.apache.myfaces.RENDER_FORM_SUBMIT_SCRIPT_INLINE", "false");
		servletContext.setInitParameter("org.apache.myfaces.CONFIG_REFRESH_PERIOD", "2");
		servletContext.setInitParameter("org.apache.myfaces.VIEWSTATE_JAVASCRIPT", "false");
		servletContext.setInitParameter("org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS", "auto");
		servletContext.setInitParameter("org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE", "false");
		servletContext.setInitParameter("org.apache.myfaces.VALIDATE_XML", "false");
		servletContext.setInitParameter("org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG", "true");

		
		servletContext.setInitParameter("org.apache.myfaces.SERIALIZE_STATE_IN_SESSION", "false");
		servletContext.setInitParameter("org.apache.myfaces.COMPRESS_STATE_IN_CLIENT", "true");
		servletContext.setInitParameter("org.apache.myfaces.COMPRESS_STATE_IN_SESSION", "false");
		servletContext.setInitParameter("org.apache.myfaces.validate", "true");
		

		servletContext.setInitParameter("javax.faces.STATE_SAVING_METHOD", "server");
//		servletContext.setInitParameter("javax.faces.FACELETS_VIEW_MAPPINGS", "*.jspx");
		servletContext.setInitParameter("javax.faces.DEFAULT_SUFFIX", ".jspx");
		
		
		
//		servletContext.setInitParameter("javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE", "true");
		
		
		servletContext.setInitParameter("com.sun.faces.duplicateJARPattern", "^tmp\\d+(\\S*\\.jar)");
		servletContext.setInitParameter("com.sun.faces.injectionProvider", "org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider");
	    
		super.doVersionSpecificInitialization();
		
		
		
	} 
}